package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dao.TCMmRefundPlanDao;
import com.jy.modules.cims.data.common.dto.TCMmRefundPlanDTO;
import com.jy.modules.cims.data.dto.RefundPlanDTO;
import com.jy.platform.core.common.BaseDTO;


/**
 * @classname: TCMmRefundPlanService
 * @description: 定义  结算计划 实现类
 * @author:  zhiqiang
 */
@Service("com.jy.modules.cims.component.common.service.TCMmRefundPlanService")
public class TCMmRefundPlanService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmRefundPlanDao dao;

	/**
     * @author zhiqiang
     * @description: 分页查询 结算计划列表
     * @date 2015-01-07 16:21:57
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmRefundPlanDTO> searchTCMmRefundPlanByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmRefundPlanDTO> dataList =  dao.searchTCMmRefundPlanByPaging(searchParams);
		return dataList;
	}
	/**
     * @author zhiqiang
     * @description: 按条件查询结算计划列表
     * @date 2015-01-07 16:21:57
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmRefundPlanDTO> searchTCMmRefundPlan(Map<String,Object> searchParams) throws Exception {
	    List<TCMmRefundPlanDTO> dataList = dao.searchTCMmRefundPlan(searchParams);
        return dataList;
    }
	
	/**
     * @author zhoup
     * @description: 分页查询 还款计划列表
     * @date 2015-01-07 16:21:57
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmRefundPlanDTO> searchRefundPlanByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmRefundPlanDTO> dataList =  dao.searchfundPlanListByPaging(searchParams);
		return dataList;
	}
	/**
     * @author zhoupeng
     * @description: 按条件查询还款计划列表  证大
     * @date 2015-01-07 16:21:57
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmRefundPlanDTO> searchfundPlanListByCreditandDate(Map<String,Object> searchParams) throws Exception {
	    List<TCMmRefundPlanDTO> dataList = dao.searchfundPlanListByCreditandDate(searchParams);
        return dataList;
    }
	
	/**
     * @author zhoupeng
     * @description: 按条件查询还款计划列表  证大  分页
     * @date 2015-01-07 16:21:57
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmRefundPlanDTO> searchfundPlanListByPaging(Map<String,Object> searchParams) throws Exception {
	    List<TCMmRefundPlanDTO> dataList = dao.searchfundPlanListByPaging(searchParams);
        return dataList;
    }
	/**
     * @author zhiqiang
     * @description: 查询结算计划对象
     * @date 2015-01-07 16:21:57
     * @param id
     * @return
     * @throws
     */ 
	public TCMmRefundPlanDTO queryTCMmRefundPlanByPrimaryKey(String id) throws Exception {
		
		TCMmRefundPlanDTO dto = dao.findTCMmRefundPlanByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmRefundPlanDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmRefundPlan
     * @author zhiqiang
     * @description: 新增 结算计划对象
     * @date 2015-01-07 16:21:57
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmRefundPlan(TCMmRefundPlanDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmRefundPlan(paramMap);
		
		TCMmRefundPlanDTO resultDto = (TCMmRefundPlanDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmRefundPlan
     * @author zhiqiang
     * @description: 修改 结算计划对象
     * @date 2015-01-07 16:21:57
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmRefundPlan(TCMmRefundPlanDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmRefundPlan(paramMap);
	}
	/**
     * @title: deleteTCMmRefundPlanByPrimaryKey
     * @author zhiqiang
     * @description: 删除 结算计划,按主键
     * @date 2015-01-07 16:21:57
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmRefundPlanByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmRefundPlanByPrimaryKey(paramMap);
	}

}

